<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>订单管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">

    <style>
        .layui-hide{  /*最后的pic为字段的field*/
            height: 100%;
            max-width: 100%;
        }
        .layui-table-cell{
            height:auto !important;
        }
    </style>
</head>
<body>



<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">订单管理</div>
                <div class="layui-card-body">
                    <div class="layui-form-item layui-form">

                        {if !empty($order)}
                        <div class="layui-inline">
                            <label class="layui-form-label">订单编号</label>

                            <div class="layui-input-block">
                                <select name="order_sn" lay-verify="" lay-search id="order_sn">
                                    <option value="">请选择</option>
                                    {foreach $order as $k=>$v}
                                    <option value="{$v['order_sn']}">{$v['order_sn']}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        {/if}
                        {if !empty($res)}
                        <div class="layui-inline">
                            <label class="layui-form-label">核销人</label>
                            <div class="layui-input-block">
                                <select name="admin_rename" lay-verify="" lay-search id="admin_rename">
                                    <option value="">请选择</option>
                                    {foreach $res as $k=>$v}
                                    <option value="{$v['admin_rename']}">{$v['admin_rename']}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        {/if}
                        <!--<div class="layui-inline">-->
                            <!--<label class="layui-form-label">核销人</label>-->
                            <!--<div class="layui-input-block">-->
                                <!--<input type="text" name="admin_rename" id="admin_rename" placeholder="请输入" autocomplete="off" class="layui-input">-->
                            <!--</div>-->
                        <!--</div>-->

                        <div class="layui-inline" >
                            <label class="layui-form-label">核销时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="search_start_time" name="search_start_time">

                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-btn-group test-table-operate-btn">
                                <button class="layui-btn" data-type="searchUserButton">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                            </div>
                        </div>

                        <!--<div class="layui-inline" style="float: right">-->
                            <!--<div class="layui-btn-group test-table-operate-btn">-->
                                <!--<button class="layui-btn" data-type="excel">-->
                                    <!--导出-->
                                <!--</button>-->
                            <!--</div>-->
                        <!--</div>-->
                    </div>
                    <table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate" lay-size="lg">



                    </table>
                    <script type="text/html" id="test-pass">

                    </script>
                    <script type="text/html" id="test-table-operate-barDemo">


                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate','set','layedit','upload'], function(){
        $ = layui.jquery;
        var table = layui.table
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate,
            upload = layui.upload
            ,form = layui.form;

        table.render({
            elem: '#test-table-operate'
            ,url: "{:url('Order/cancel_order')}"
            ,height: 'full-100'
            ,cols: [[
                {field:'id',align:"center",title: 'ID'}
                ,{field:'order_sn',align:"center",title: '订单编号'}
                ,{field:'admin_rename',align:"center",title: '核销人'}
                ,{field:'money',align:"center",title: '核销金额'}
                ,{field:'create_time',align:"center",title: '核销时间'}
            ]]
            ,page: true
            ,limit: 20
        });

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#LAY-component-form-group-date'
        });
        var search_start = laydate.render({ //活动开始
            elem: '#search_start_time',
            range:'~'

        });
        //监听工具条
        table.on('tool(test-table-operate)', function(obj){
            var data = obj.data;

        });




        var $ = layui.$, active = {
            searchUserButton:function(){
                var order_sn  = $('#order_sn').val();

                var admin_rename = $('#admin_rename').val();
                var search_start_time  = $('#search_start_time').val();
                table.reload('test-table-operate', {
                    where: {
                        order_sn:order_sn,
                        admin_rename:admin_rename,
                        search_start_time:search_start_time,
                    }
                    ,page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
                //return false;
            },
            excel:function () {
                window.location.href ="{:url('Order/excel')}"
            }
        };
        //绑定点击事件
        $('.test-table-operate-btn .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });


    });

</script>

</body>
</html>